<?
	session_start();	

	require("include/connect.inc.php");
	($db = mysql_connect("$serveur", "$utilisateur", "$motdepasse")) or die("<CENTER><A style='color:white;background-color:red'> D�ol� probl�e de serveur</a><br><br>Impossible de se connecter au serveur</center><br></td></tr></table></body></html>");
	mysql_select_db("$database",$db) or die("<CENTER><A style='color:white;background-color:red'> Désolé problème de serveur</a><br><br>Impossible de se connecter à la base de données</center><br></td></tr></table></body></html>");
	
	require('include/fonctions_bd.php');
	require('include/fonctions.php');
	
	 $err_log = "";
	 
	 if(isset($_POST['login'])) {
		$login = $_POST['login'];
		
		if(getNbLogin($login) == 1) {
			$passwd = getPasswdByLogin($login);
			if(md5($_POST['passwd']) == $passwd) {
				session_register('login');
			} else {
				$err_log = "<FONT color=red><B>Mauvais mot de passe</B></FONT><BR /><BR />";	
			}
		} else {
			$err_log = "<FONT color=red><B>Ce login n'existe pas</B></FONT><BR /><BR />";	
		}
	 }
	
	 if(isset($_GET['action'])) {
		 if($_GET['action']=='unlog')
	 		session_unregister('login');
 	 }
	 	
	 if(session_is_registered('login')) {
		 $login = $_SESSION['login'];
	 }
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta Name="keywords" Content="association, jongle, jonglage, jonglerie, nantes, orvault, loire atlantique" />
  <meta Name="author" Content="Garreau Jean-Francois" />
  <meta Name="description" Content="site de l'association Roule Maboule" />
  <title>Roule Maboule, la jongle orvaltaise</title>
  <link rel="stylesheet" type="text/css" href="css/template_css.css" />
  <!--<style type="text/css" media="all">@import "css/style.css";</style>-->
  <link rel="shortcut icon" href="images/favicon_white_32.jpg" />
<?

/**
 * Import de la classe javaScript correspondant à la page en cours
 */ 
echo "<script src='templates/js/".$page.".js'></script>";
?>
<script src='include/frameworks/jquery-1.2.6.min.js'></script>
<script src='include/frameworks/ajaxfileupload.js'></script>
<script src='include/function.js'></script>
</head>
<body>
  <div id="middle">
    <div id="mini_menu" style="position:absolute; top:0px; left:75%; font-size:10px;">
      <a href="index.php?page=body_accueil" style="padding-right:10px;">Accueil</a>
      <a href="index.php?page=contacts" style="border-left:#748D77 solid 1px; padding-right:10px; padding-left:10px;">Contact</a>
    </div>
  </div>
  <div id="menu">
    <a class="menu" href="index.php?page=body_accueil">Accueil</a>
    <a class="menu" href="index.php?page=articles" style="border-left:white solid 1px;">Articles</a>
    <a class="menu" href="index.php?page=galerie" style="border-left:white solid 1px;">Galerie</a>
    <a class="menu" href="forum/" style="border-left:white solid 1px;">Forum</a>
    <a class="menu" href="index.php?page=siteswap" style="border-left:white solid 1px;">SiteSwap</a>
    <a class="menu" href="index.php?page=agenda" style="border-left:white solid 1px;">Agenda</a>
    <a class="menu" href="index.php?page=liens" style="border-left:white solid 1px;">Liens</a>
    <a class="menu" href="index.php?page=contacts" style="border-left:white solid 1px;">Contacts</a>
  </div>
  <div style="background:#9abb9b; width:80px; height:20px; margin:auto;">
  </div>
  <div id="content_top">
  </div>
  <div id="content_middle">
    <!--DIV de contenu-->
    <div style="width:865px; margin:auto; margin-left:20px;">
		<? 	
    
    if ($page != "body_accueil") {
		  $type_sswap = "";
		  if(isset($_GET["type_sswap"])){
		    $type_sswap = "_".$_GET["type_sswap"];
      }
		  echo "<DIV align='center'>";
			echo "<IMG ID='idImgModule' SRC='images/".$page.$type_sswap.".png' align='center'>";
      echo "</DIV>"; 
			}
			
		?>
	
